'use strict'

define(['jquery', 'bootstrap', 'select2', 'datetimepicker', 'datetimepickerCN',
	'shiftform', 'validate', 'validate.en',
	'uploader', 'plupload', 'qiniu'], function($) {

		return {

			init: function() {
				this.initCreate();
				this.initDelete();
			},


			initCreate: function() {
				var that = this;

				$(document).on("shown.bs.modal", "#create, #edit", function(e) {
					var $form = $(e.currentTarget).find("form");

					$form.bt_validate();

					$form.shiftform({
						beforeSubmit: function(el) {
							$('form').trigger("validate.ajax.submit");
							return $.bt_validate.result[$.bt_validate.form_id]
						}
					});
				})

			},


			initDelete: function() {
				$(document).on("shown.bs.modal", "#delete", function(e) {
					var $form = $(e.currentTarget).find("form");
					$form.shiftform();
				})

			},


		}
	})
